package com.yiyi.credit.manage.abutment.common.enums;


public enum PeriodUnitType {


    DAY(1, "天"),
    MONTH(2, "月");


    private final int key;


    private final String value;

    PeriodUnitType(int key, String value) {
        this.key = key;
        this.value = value;
    }

    public static PeriodUnitType getEnumByKey(int key) {
        for (PeriodUnitType item : PeriodUnitType.values()) {
            if (item.getKey() == key) {
                return item;
            }
        }
        throw new RuntimeException(String.format("未找到对应期限单位:{%s}", key));
    }

    public int getKey() {
        return key;
    }

    public String getValue() {
        return value;
    }
}
